package com.atguigu.rabbitmqdemo01.listener;


import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;



@Component
public class MyMessageListener {

//    一个simple
//    @RabbitListener(queues = {"zzp.queue.simple"})
//    public void processMessage(String messageContent, Message message, Channel channel) {
//        System.out.println("messageContent = " + messageContent);
//    }

    @Value("${server.port}")
    private String serverPort;

    @RabbitListener(queues = {"zzp.queue.work"})
    public void processMessage(String messageContent, Message message, Channel channel) {
        System.out.println("Server Port:" + serverPort + " Message Content:" + messageContent);
    }
}
